package com.scott.ch040

import com.mongodb.casbah.commons.MongoDBObject
import com.mongodb.casbah.{MongoClient}

object ScottMongoDB {

  def main(args: Array[String]): Unit = {
    val mongoClient= MongoClient("192.168.235.128", 27017);
    val db = mongoClient.getDB("crm-db");
    val tables = db.getCollection("user_t");
    val counter  = tables.getCount();
    println("counter="+counter)
    val query =MongoDBObject("name" -> "hy")
    val user = tables.findOne(query)
    println("user="+user);
  }

}
